/*
 * @lc app=leetcode.cn id=507 lang=java
 *
 * [507] 完美数
 */

// @lc code=start
class Solution {
    public boolean checkPerfectNumber(int num) {
        int ans = 0;
        if(num == 1 ) return false;
        for(int i = 2 ; i<=(int)Math.sqrt(num) ;i++){
            if(num % i == 0){
                ans += i+num/i;
            }
        }
        return (ans+1) == num;
    }
}
// @lc code=end

